const user = {
  state: {
    info: {
      id: "",
      useTime: "",
      subInfo: {
        //测试内容
        subName: "",  // 学科
        editionName: "", // 版本
        gradeName: "", // 年级
        chapterList: []  // 章节
      },
      userInfo: {
        //用户信息 校区信息
        name: "张三"
      },
      data: {
        //题目知识点详情
      },
      s: {},
      paperId: "",
      answerList: [] //学生答案选择
    },
    question: [],
    param: {},
  },

  mutations: {
    // 设置问题
    SET_QUERTION: (state, question) => {
      state.question = question;
    },
    // 设置 难度、章节
    SET_PARAM: (state, param) => {
      state.param = param;
    },
    // 设置 学科、版本、年级
    SET_INFO: (state, param) => {
      state.info = param;
    },
  },

  actions: {
    // 获取用户信息
    setQuertionInfo({ commit }, question) {
      return new Promise((resolve, reject) => {
        commit("SET_QUERTION", question);
        resolve();
      });
    },
    setParam({ commit }, param) {
      return new Promise((resolve, reject) => {
        commit("SET_PARAM", param);
        resolve();
      });
    },

    setInfo({ commit }, param) {
      return new Promise((resolve, reject) => {
        commit("SET_INFO", param);
        resolve();
      });
    }
  }
};

export default user;
